home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / modula2.vim < prev    next >
Encoding:
Text File  |  2001-05-10  |  3.5 KB  |  87 lines

  1. " Vim syntax file
  2. " Language:    Modula 2
  3. " Maintainer:    pf@artcom0.north.de (Peter Funk)
  4. "   based on original work of Bram Moolenaar <Bram@vim.org>
  5. " Last Change:    2001 May 09
  6.  
  7. " For version 5.x: Clear all syntax items
  8. " For version 6.x: Quit when a syntax file was already loaded
  9. if version < 600
  10.   syntax clear
  11. elseif exists("b:current_syntax")
  12.   finish
  13. endif
  14.  
  15. " Don't ignore case (Modula-2 is case significant). This is the default in vim
  16.  
  17. " Especially emphasize headers of procedures and modules:
  18. syn region modula2Header matchgroup=modula2Header start="PROCEDURE " end="(" contains=modula2Ident oneline
  19. syn region modula2Header matchgroup=modula2Header start="MODULE " end=";" contains=modula2Ident oneline
  20. syn region modula2Header matchgroup=modula2Header start="BEGIN (\*" end="\*)" contains=modula2Ident oneline
  21. syn region modula2Header matchgroup=modula2Header start="END " end=";" contains=modula2Ident oneline
  22. syn region modula2Keyword start="END" end=";" contains=ALLBUT,modula2Ident oneline
  23.  
  24. " Some very important keywords which should be emphasized more than others:
  25. syn keyword modula2AttKeyword CONST EXIT HALT RETURN TYPE VAR
  26. " All other keywords in alphabetical order:
  27. syn keyword modula2Keyword AND ARRAY BY CASE DEFINITION DIV DO ELSE
  28. syn keyword modula2Keyword ELSIF EXPORT FOR FROM IF IMPLEMENTATION IMPORT
  29. syn keyword modula2Keyword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD
  30. syn keyword modula2Keyword SET THEN TO UNTIL WHILE WITH
  31.  
  32. syn keyword modula2Type ADDRESS BITSET BOOLEAN CARDINAL CHAR INTEGER REAL WORD
  33. syn keyword modula2StdFunc ABS CAP CHR DEC EXCL INC INCL ORD SIZE TSIZE VAL
  34. syn keyword modula2StdConst FALSE NIL TRUE
  35. " The following may be discussed, since NEW and DISPOSE are some kind of
  36. " special builtin macro functions:
  37. syn keyword modula2StdFunc NEW DISPOSE
  38. " The following types are added later on and may be missing from older
  39. " Modula-2 Compilers (they are at least missing from the original report
  40. " by N.Wirth from March 1980 ;-)  Highlighting should apply nevertheless:
  41. syn keyword modula2Type BYTE LONGCARD LONGINT LONGREAL PROC SHORTCARD SHORTINT
  42. " same note applies to min and max, which were also added later to m2:
  43. syn keyword modula2StdFunc MAX MIN
  44. " The underscore was originally disallowed in m2 ids, it was also added later:
  45. syn match   modula2Ident " [A-Z,a-z][A-Z,a-z,0-9,_]*" contained
  46.  
  47. " Comments may be nested in Modula-2:
  48. syn region modula2Comment start="(\*" end="\*)" contains=modula2Comment,modula2Todo
  49. syn keyword modula2Todo    contained TODO FIXME XXX
  50.  
  51. " Strings
  52. syn region modula2String start=+"+ end=+"+
  53. syn region modula2String start="'" end="'"
  54. syn region modula2Set start="{" end="}"
  55.  
  56. " Define the default highlighting.
  57. " For version 5.7 and earlier: only when not done already
  58. " For version 5.8 and later: only when an item doesn't have highlighting yet
  59. if version >= 508 || !exists("did_modula2_syntax_inits")
  60.   if version < 508
  61.     let did_modula2_syntax_inits = 1
  62.     command -nargs=+ HiLink hi link <args>
  63.   else
  64.     command -nargs=+ HiLink hi def link <args>
  65.   endif
  66.  
  67.   HiLink modula2Ident        Identifier
  68.   HiLink modula2StdConst    Boolean
  69.   HiLink modula2Type        Identifier
  70.   HiLink modula2StdFunc        Identifier
  71.   HiLink modula2Header        Type
  72.   HiLink modula2Keyword        Statement
  73.   HiLink modula2AttKeyword    PreProc
  74.   HiLink modula2Comment        Comment
  75.   " The following is just a matter of taste (you want to try this instead):
  76.   " hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold
  77.   HiLink modula2Todo        Todo
  78.   HiLink modula2String        String
  79.   HiLink modula2Set        String
  80.  
  81.   delcommand HiLink
  82. endif
  83.  
  84. let b:current_syntax = "modula2"
  85.  
  86. " vim: ts=8
  87.